package com.vmj.classfile.entity.constantinfo;

import com.vmj.classfile.ClassReader;
import com.vmj.classfile.entity.AbstractConstantInfo;
import com.vmj.classfile.entity.ConstantPool;

/**
 * Created by yangshoujun on 2017/8/6 下午1:50.
 */
public class ConstantClassInfo extends AbstractConstantInfo {

    int nameIndex;
    ConstantPool cp;

    public ConstantClassInfo(ClassReader reader, ConstantPool cp) {
        super(reader);
        this.cp = cp;
    }

    public void parse() {
        nameIndex = getReader().readTwoByte();
    }

    public int getNameIndex() {
        return nameIndex;
    }

    public String getName() {
        return this.cp.getUtf8(this.nameIndex);
    }
}
